/*
 * this represents a list of contacts.
 * 
 */
package MODEL;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Observable;

/**
 *
 * @author Irene & Morten
 */
public class Contact extends Observable implements Serializable {

    private String name;
    private String phoneNumber;
    private String address;
    private String email;
    private String note;
    private ArrayList<String> family;
    private ArrayList<String> friends;
    private ArrayList<String> work;
    private ArrayList<String> gym;
    private ArrayList<String> other;

    public Contact() {
        family = new ArrayList<String>();
        friends = new ArrayList<String>();
        work = new ArrayList<String>();
        gym = new ArrayList<String>();
        other = new ArrayList<String>();
    }

    public ArrayList<String> getFamily() {
        return family;
    }

    public ArrayList<String> getFriends() {
        return friends;
    }

    public ArrayList<String> getGym() {
        return gym;
    }

    public ArrayList<String> getOther() {
        return other;
    }

    public ArrayList<String> getWork() {
        return work;
    }

    /*adds contactFriends to the arraylist friends notifies observer
     * @param name the name
     * @param phoneNumber the phonenumber
     * @param addresse the persons addresse
     * @param note obtional comment
     */
    public void addContactFriend(String name, String phoneNumber, String address, String email, String note) {
        this.name = name;
        this.phoneNumber = phoneNumber;
        this.address = address;
        this.email = email;
        this.note = note;
        String s = ("________________");
        friends.add(name);
        friends.add(phoneNumber);
        friends.add(address);
        friends.add(email);
        friends.add(note);
        friends.add(s);
        setChanged();
        notifyObservers();
    }


    /*adds contactFamily to the arraylist family notifies observer
     * @param name the name
     * @param phoneNumber the phonenumber
     * @param addresse the persons address
     * @param email the email
     * @param note obtional comment
     */
    public void addContactFamily(String name, String phoneNumber, String address, String email, String note) {
        this.name = name;
        this.phoneNumber = phoneNumber;
        this.address = address;
        this.email = email;
        this.note = note;
        String s = ("________________");
        family.add(name);
        family.add(phoneNumber);
        family.add(address);
        family.add(email);
        family.add(note);
        family.add(s);
        setChanged();
        notifyObservers();
    }

    /*adds contactWork to the arraylist work notifies observer
     * @param name the name
     * @param phoneNumber the phonenumber
     * @param addresse the persons address
     * @param email the email
     * @param note obtional comment
     */
    public void addContactWork(String name, String phoneNumber, String address, String email, String note) {
        this.name = name;
        this.phoneNumber = phoneNumber;
        this.address = address;
        this.email = email;
        this.note = note;
        String s = ("________________");
        work.add(name);
        work.add(phoneNumber);
        work.add(address);
        work.add(email);
        work.add(note);
        work.add(s);
        setChanged();
        notifyObservers();
    }

    /*adds contactGym to the arraylist gym notifies observer
     * @param name the name
     * @param phoneNumber the phonenumber
     * @param addresse the persons address
     * @param email the email
     * @param note obtional comment
     */
    public void addContactGym(String name, String phoneNumber, String address, String email, String note) {
        this.name = name;
        this.phoneNumber = phoneNumber;
        this.address = address;
        this.email = email;
        this.note = note;
        String s = ("________________");
        gym.add(name);
        gym.add(phoneNumber);
        gym.add(address);
        gym.add(email);
        gym.add(note);
        gym.add(s);
        setChanged();
        notifyObservers();
    }
    /*adds contactother to the arraylist other and notifies observer
     * @param name the name
     * @param phoneNumber the phonenumber
     * @param addresse the persons address
     * @param email the email
     * @param note obtional comment
     */

    public void addContactOther(String name, String phoneNumber, String address, String email, String note) {
        this.name = name;
        this.phoneNumber = phoneNumber;
        this.address = address;
        this.email = email;
        this.note = note;
        String s = ("________________");
        other.add(name);
        other.add(phoneNumber);
        other.add(address);
        other.add(email);
        other.add(note);
        other.add(s);
        setChanged();
        notifyObservers();
    }

    /*Removes the string from the family and notifies observer
     * @param s is the string to remove
     */
    public void removeFamily(String s) {
        family.remove(s);
        setChanged();
        notifyObservers();
    }

    public void removeFriend(String s) {
        friends.remove(s);
        setChanged();
        notifyObservers();

    }

    public void removeWork(String s) {
        work.remove(s);
        setChanged();
        notifyObservers();

    }

    public void removeGym(String s) {
        gym.remove(s);
        setChanged();
        notifyObservers();
    }

    public void removeOther(String s) {
        other.remove(s);
        setChanged();
        notifyObservers();
    }
}